package com.codescan.admin.modules.codescan.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.codescan.admin.common.exception.ApiException;
import com.codescan.admin.modules.codescan.mapper.SourceCodeMapper;
import com.codescan.admin.modules.codescan.model.SourceCodeVo;
import com.codescan.admin.modules.codescan.model.SourceReportVo;
import com.codescan.admin.modules.codescan.service.ISourceCodeService;
import com.codescan.admin.modules.codescan.service.ISourceReportService;
import com.codescan.admin.modules.sys.model.SysFile;
import com.codescan.admin.modules.sys.service.IFileService;
import com.codescan.admin.utils.ZipUtils;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.python.util.PythonInterpreter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.io.*;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Objects;

@Slf4j
@Service
public class SourceCodeServiceImpl extends ServiceImpl<SourceCodeMapper, SourceCodeVo> implements ISourceCodeService {
    @Autowired
    private ISourceReportService sourceReportService;


    @Override
    public boolean saveSourceCode(SourceCodeVo sourceCodeVo) {
        sourceCodeVo.setUploadTime(LocalDateTime.now().format(DateTimeFormatter.ISO_LOCAL_DATE_TIME));
        boolean flag = this.save(sourceCodeVo);
        return flag;
    }
}
